const { sequelize } = require("../../core/db");
const { Sequelize, Model } = require("sequelize");

class Address extends Model {}

Address.init(
  {
    address_id: {
      type: Sequelize.INTEGER,
      primaryKey: true,
      autoIncrement: true,
    },
    phone: {
      type: Sequelize.STRING,
    },
    uid: Sequelize.STRING,
    province: {
      type: Sequelize.STRING,
      comment: "省",
    },
    city: {
      type: Sequelize.STRING,
      comment: "市",
    },
    district: {
      type: Sequelize.STRING,
      comment: "区",
    },
    house: {
      type: Sequelize.STRING,
      comment: "具体地址",
    },
    is_default: {
      type: Sequelize.BOOLEAN,
      defaultValue: false,
      comment: "是否默认地址",
    },
    consignee: {
      type: Sequelize.STRING,
      comment: "收货人",
    },
  },
  {
    sequelize,
    tableName: "address",
  }
);

module.exports = {
  Address,
};
